import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from hyrobot.common import CHECK_POINT, STEP

class c73300:
    name = "验证登录功能-73300"
    driver = webdriver.Firefox()


    def teststeps(self):
        self.driver.implicitly_wait(3)

        self.driver.get("http://172.17.66.19:8080/")
        STEP(1, '输入未注册过的账号，输入任意密码，点击登录')
        input_username = self.driver.find_element(By.NAME, "username").send_keys('byhy1')
        input_psw = self.driver.find_element(By.NAME, "password").send_keys('888888')
        self.driver.find_element(By.CSS_SELECTOR, ".el-button").click()
        getted = False
        a = ""
        # a = self.driver.find_element(By.CSS_SELECTOR, "body > div.el-message.el-message--error > p").text
        while a != "账号不存在":
            try:
                a += self.driver.find_element(By.CLASS_NAME, "el-message--error").text
            except Exception:
                getted = False
                print(False)
                continue
            # getted = True
        print("------------",a)
        expeted_msg = "账号不存在"
        CHECK_POINT("验证是否为期待文字",a == expeted_msg)

        self.driver.quit()